var SequelizeAuto = require('sequelize-auto')

//各个数据库配置
let dbConfig = [
  {
    name: 'test', auto: true, adapter: 'sails-mysql', host: '127.0.0.1', port: 3306, user: 'root', password: 'root01', database: 'tw', modelPath: './test',
  },
]

for (const data of dbConfig) {
  let auto = new SequelizeAuto(data.database, data.user, data.password, {
    host: data.host,
    dialect: 'mysql',
    directory: data.modelPath, // prevents the program from writing to disk
    port: data.port,
    // caseModel: 'c', // convert snake_case column names to camelCase field names: user_id -> userId
    caseFile: 'c', // file names created for each model use camelCase.js not snake_case.js
    singularize: true, // convert plural table names to singular model names
    additional: {
      // freezeTableName: true,
      //启动默认时间戳
      timestamps: false,
      // 自定义创建时间和修改时间字段
    //   updatedAt: 'gmt_modified',
    //   createdAt: 'gmt_create'
    }
});
auto.run(function (err) {
  if (err) throw err;
  console.log(auto.tables); // table list
  console.log(auto.foreignKeys); // foreign key list
});
}
